﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
namespace QL_KHACHSAN.Forms
{
    public partial class frmDatPhong : Office2007Form
    {
        private static int INT_MAXPHONG = 100;
        private static int INT_PANEL_WIDTH = 106;
        private static int INT_PANEL_HEIGHT = 91;
        private static int INT_PANEL_X=1;
        private static int INT_PANEL_Y = 1;

        private int INT_PANEL = 0;
        public frmDatPhong()
        {
            InitializeComponent();
        }

        Panel[] panPhong = new Panel[INT_MAXPHONG];
        FlexControls.fcButtonX[] Phong = new FlexControls.fcButtonX[INT_MAXPHONG];
        private void frmDatPhong_Load(object sender, EventArgs e)
        {
            int int_MaxRow = 0;
            string strSQL = "select * from PHONG";
            ADODB.Recordset Rs = new ADODB.Recordset();
            Rs.Open(strSQL,clsMain.flexConn.fcConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1);
            if (Rs.RecordCount > 0)
            {
                for (int i = 0; i < Rs.RecordCount; i++)
                {
                    if (int_MaxRow > 4)
                    {
                        int_MaxRow = 0;
                    }

                    Phong[i] = new FlexControls.fcButtonX();
                    Phong[i].Size = new System.Drawing.Size(INT_PANEL_WIDTH, INT_PANEL_HEIGHT);
                    Phong[i].Visible = true;
                    Phong[i].Location = new Point(int_MaxRow * 120, (INT_PANEL / 5) * (INT_PANEL_HEIGHT + 10));
                    Phong[i].strMaPhong = Rs.Fields[1].Value;
                    Phong[i].intGiaPhong = Convert.ToInt32(Rs.Fields[4].Value);
                    Phong[i].KhoiTaoButtonX();
                    tabControl1.TabPages[0].Controls.Add(Phong[i]);
                    INT_PANEL++;
                    int_MaxRow++;
                    Rs.MoveNext();
                }
            }
            
            
        }

        private void MouseHover(object sender, EventArgs e,int i)
        {
            panPhong[i].BackColor = System.Drawing.Color.Red;
        }

        

       

       
    }
}
